<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
      <title>GTL - Graph Template Library: st_number.h Source File</title>
      <link href="doxygen.css" rel="stylesheet" type="text/css">
  </head>
  <body>
    <p class="links">  
      <a href="../index.html">Home</a> |
      Documentation |
      <a href="../register.html">Download</a> |
      <a href="../platforms.html">Platforms</a> |
      <a href="../refer.html">Projects</a> |      
      <a href="../lists.html">Mailing Lists</a> |
      <a href="../history.html">Version History</a>
    </p>

<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>st_number.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==========================================================================</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">//   st_number.h</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">//==========================================================================</span>
<a name="l00006"></a>00006 <span class="comment">// $Id: st_number.h,v 1.17 2002/12/20 08:26:08 chris Exp $</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef GTL_ST_NUMBER_H</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define GTL_ST_NUMBER_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;GTL/GTL.h&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;GTL/graph.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;GTL/node_map.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;GTL/edge_map.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;GTL/algorithm.h&gt;</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;list&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;utility&gt;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 __GTL_BEGIN_NAMESPACE
<a name="l00021"></a>00021 
<a name="l00025"></a>00025 <span class="keyword">class </span>GTL_EXTERN pathfinder 
<a name="l00026"></a>00026 {
<a name="l00027"></a>00027 <span class="keyword">public</span>:
<a name="l00028"></a>00028     <span class="comment">//---------------------------------------------------------- CONSTRUCTOR</span>
<a name="l00029"></a>00029         
<a name="l00033"></a>00033     pathfinder(<span class="keyword">const</span> <a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G, <a class="code" href="a00010.html" title="An edge in a graph.">edge</a> st, <a class="code" href="a00020.html" title="A node in a graph.">node</a> s);    
<a name="l00034"></a>00034         
<a name="l00038"></a>00038     <span class="keywordtype">bool</span> is_valid()
<a name="l00039"></a>00039     {
<a name="l00040"></a>00040         <span class="keywordflow">return</span> is_biconn;
<a name="l00041"></a>00041     }
<a name="l00042"></a>00042         
<a name="l00043"></a>00043     <span class="comment">//------------------------------------------------------------- ITERATOR</span>
<a name="l00044"></a>00044         
<a name="l00048"></a>00048     <span class="keyword">class </span>const_iterator 
<a name="l00049"></a>00049     {
<a name="l00050"></a>00050     <span class="keyword">public</span>:
<a name="l00054"></a>00054         const_iterator(pathfinder&amp; _pf) : pf (_pf)
<a name="l00055"></a>00055         {
<a name="l00056"></a>00056         }
<a name="l00057"></a>00057 
<a name="l00061"></a>00061         const_iterator(pathfinder&amp; _pf, <a class="code" href="a00020.html" title="A node in a graph.">node</a> n);        
<a name="l00062"></a>00062                 
<a name="l00066"></a>00066         const_iterator&amp; operator++();
<a name="l00070"></a>00070         const_iterator operator++(<span class="keywordtype">int</span>);
<a name="l00074"></a>00074         <span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; operator*()<span class="keyword"> const </span>
<a name="l00075"></a>00075 <span class="keyword">        </span>{
<a name="l00076"></a>00076             <span class="keywordflow">return</span> curr;
<a name="l00077"></a>00077         }
<a name="l00078"></a>00078                 
<a name="l00082"></a>00082         <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> const_iterator&amp; it) 
<a name="l00083"></a>00083         {
<a name="l00084"></a>00084             <span class="keywordflow">return</span> curr == it.curr;
<a name="l00085"></a>00085         }
<a name="l00086"></a>00086 
<a name="l00090"></a>00090         <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> const_iterator&amp; it)
<a name="l00091"></a>00091         {
<a name="l00092"></a>00092             <span class="keywordflow">return</span> curr != it.curr;
<a name="l00093"></a>00093         }
<a name="l00094"></a>00094     <span class="keyword">private</span>:
<a name="l00098"></a>00098         <span class="keyword">enum</span> iteration_state {END, UP, DOWN};
<a name="l00099"></a>00099 
<a name="l00103"></a>00103         iteration_state state;
<a name="l00104"></a>00104 
<a name="l00108"></a>00108         <a class="code" href="a00020.html" title="A node in a graph.">node</a> curr;
<a name="l00109"></a>00109 
<a name="l00113"></a>00113         pathfinder&amp; pf;
<a name="l00114"></a>00114     };
<a name="l00115"></a>00115         
<a name="l00119"></a>00119     const_iterator path(<a class="code" href="a00020.html" title="A node in a graph.">node</a> n)
<a name="l00120"></a>00120     {
<a name="l00121"></a>00121         <span class="keywordflow">return</span> const_iterator(*<span class="keyword">this</span>, n);
<a name="l00122"></a>00122     }
<a name="l00123"></a>00123         
<a name="l00127"></a>00127     const_iterator end()
<a name="l00128"></a>00128     {
<a name="l00129"></a>00129         <span class="keywordflow">return</span> const_iterator (*<span class="keyword">this</span>);
<a name="l00130"></a>00130     }
<a name="l00131"></a>00131         
<a name="l00132"></a>00132 <span class="keyword">private</span>:
<a name="l00133"></a>00133     <span class="comment">//------------------------------------------------------------ FUNCTIONS</span>
<a name="l00134"></a>00134                 
<a name="l00138"></a>00138     <span class="keywordtype">void</span> dfs_sub (<a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp;, <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp;);
<a name="l00139"></a>00139                 
<a name="l00140"></a>00140     <span class="comment">//-------------------------------------------------------------- MEMBERS </span>
<a name="l00141"></a>00141                 
<a name="l00145"></a>00145     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;int&gt;</a> dfs_num;
<a name="l00146"></a>00146 
<a name="l00150"></a>00150     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;int&gt;</a> low_num;
<a name="l00151"></a>00151 
<a name="l00155"></a>00155     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;edge&gt;</a> &gt; tree;
<a name="l00156"></a>00156 
<a name="l00160"></a>00160     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;edge&gt;</a> &gt; back;
<a name="l00161"></a>00161 
<a name="l00165"></a>00165     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;edge&gt;</a> &gt; forward;
<a name="l00166"></a>00166 
<a name="l00170"></a>00170     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;edge&gt;::iterator</a>&gt; to_low;
<a name="l00171"></a>00171 
<a name="l00175"></a>00175     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;edge&gt;::iterator</a>&gt; to_father;
<a name="l00176"></a>00176                 
<a name="l00180"></a>00180     <span class="keyword">typedef</span> pair&lt;list&lt;edge&gt;::iterator, list&lt;edge&gt;::iterator&gt; pos_pair;
<a name="l00181"></a>00181 
<a name="l00185"></a>00185     <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;pos_pair &gt;</a> pos;
<a name="l00186"></a>00186 
<a name="l00190"></a>00190     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;int&gt;</a> used;
<a name="l00191"></a>00191                 
<a name="l00195"></a>00195     <span class="keywordtype">int</span> act_dfs_num;
<a name="l00196"></a>00196 
<a name="l00200"></a>00200     <span class="keywordtype">int</span> new_nodes;
<a name="l00201"></a>00201 
<a name="l00205"></a>00205     <span class="keywordtype">bool</span> is_biconn;
<a name="l00206"></a>00206                 
<a name="l00211"></a>00211     <span class="keyword">friend</span> <span class="keyword">class </span>const_iterator;
<a name="l00212"></a>00212 };
<a name="l00213"></a>00213 
<a name="l00232"></a><a class="code" href="a00026.html">00232</a> <span class="keyword">class </span>GTL_EXTERN <a class="code" href="a00026.html" title="ST-number algorithm.">st_number</a> : <span class="keyword">public</span> <a class="code" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a> 
<a name="l00233"></a>00233 {
<a name="l00234"></a>00234 <span class="keyword">public</span>:
<a name="l00242"></a><a class="code" href="a00026.html#07532323fbcc643dfc419809385b64a7">00242</a>     <a class="code" href="a00026.html" title="ST-number algorithm.">st_number</a>() : <a class="code" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a>()
<a name="l00243"></a>00243     {
<a name="l00244"></a>00244     }
<a name="l00245"></a>00245 
<a name="l00249"></a><a class="code" href="a00026.html#4f3a2a6ceab39d106c920ee3546c259d">00249</a>     <span class="keyword">virtual</span> ~<a class="code" href="a00026.html" title="ST-number algorithm.">st_number</a>()
<a name="l00250"></a>00250     {
<a name="l00251"></a>00251     }
<a name="l00252"></a>00252         
<a name="l00258"></a><a class="code" href="a00026.html#1564af6f603160105643f22bf2f6955b">00258</a>     <span class="keywordtype">void</span> st_edge(<a class="code" href="a00010.html" title="An edge in a graph.">edge</a> e)
<a name="l00259"></a>00259     {
<a name="l00260"></a>00260         st = e;
<a name="l00261"></a>00261     }
<a name="l00262"></a>00262 
<a name="l00268"></a><a class="code" href="a00026.html#58fc3b24be01d7b06fd4b6f94340e1c3">00268</a>     <a class="code" href="a00010.html" title="An edge in a graph.">edge</a> st_edge()<span class="keyword"> const</span>
<a name="l00269"></a>00269 <span class="keyword">    </span>{
<a name="l00270"></a>00270         <span class="keywordflow">return</span> st;
<a name="l00271"></a>00271     }
<a name="l00272"></a>00272 
<a name="l00282"></a><a class="code" href="a00026.html#a607c9aaa5a4d9c45e5854ce672f0fda">00282</a>     <span class="keywordtype">void</span> s_node(<a class="code" href="a00020.html" title="A node in a graph.">node</a> n) 
<a name="l00283"></a>00283     {
<a name="l00284"></a>00284         s = n;
<a name="l00285"></a>00285     }
<a name="l00286"></a>00286 
<a name="l00292"></a><a class="code" href="a00026.html#48e4837ebed88445c1f594024d8753dc">00292</a>     <a class="code" href="a00020.html" title="A node in a graph.">node</a> s_node()<span class="keyword"> const</span>
<a name="l00293"></a>00293 <span class="keyword">    </span>{
<a name="l00294"></a>00294         <span class="keywordflow">return</span> s;
<a name="l00295"></a>00295     }
<a name="l00296"></a>00296 
<a name="l00304"></a><a class="code" href="a00026.html#969162a10da5daba4219419d45c4be51">00304</a>     <span class="keywordtype">int</span>&amp; operator[](<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n)
<a name="l00305"></a>00305     {
<a name="l00306"></a>00306         <span class="keywordflow">return</span> st_num[n];
<a name="l00307"></a>00307     }
<a name="l00308"></a>00308     
<a name="l00312"></a>00312     <span class="keyword">typedef</span> list&lt;node&gt;::iterator iterator;
<a name="l00313"></a>00313 
<a name="l00317"></a>00317     <span class="keyword">typedef</span> list&lt;node&gt;::reverse_iterator reverse_iterator;
<a name="l00318"></a>00318         
<a name="l00325"></a><a class="code" href="a00026.html#1eddb2577b16109d22cde98a8ffde057">00325</a>     iterator begin()
<a name="l00326"></a>00326     {
<a name="l00327"></a>00327         <span class="keywordflow">return</span> st_ord.begin();
<a name="l00328"></a>00328     }   
<a name="l00329"></a>00329 
<a name="l00335"></a><a class="code" href="a00026.html#3912b83a8cbddcb1fc804d20be528d52">00335</a>     iterator end()
<a name="l00336"></a>00336     {
<a name="l00337"></a>00337         <span class="keywordflow">return</span> st_ord.end();
<a name="l00338"></a>00338     }
<a name="l00339"></a>00339         
<a name="l00347"></a><a class="code" href="a00026.html#56f2c67e9b49362947fe0c99278f6d31">00347</a>     reverse_iterator rbegin()
<a name="l00348"></a>00348     {
<a name="l00349"></a>00349         <span class="keywordflow">return</span> st_ord.rbegin();
<a name="l00350"></a>00350     }
<a name="l00351"></a>00351         
<a name="l00358"></a><a class="code" href="a00026.html#4c5fdce6ab2be7ee9ddbb09e8d5c8560">00358</a>     reverse_iterator rend()
<a name="l00359"></a>00359     {
<a name="l00360"></a>00360         <span class="keywordflow">return</span> st_ord.rend();
<a name="l00361"></a>00361     }
<a name="l00362"></a>00362         
<a name="l00363"></a>00363 
<a name="l00379"></a>00379     <span class="keywordtype">int</span> <a class="code" href="a00001.html#76361fb03ad1cf643affc51821e43bed" title="Checks whether all preconditions are satisfied.">check</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00380"></a>00380 
<a name="l00381"></a>00381 
<a name="l00394"></a>00394     <span class="keywordtype">int</span> <a class="code" href="a00001.html#734b189509a8d6b56b65f8ff772d43ca" title="Applies algorithm to graph g.">run</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00395"></a>00395 
<a name="l00396"></a>00396 
<a name="l00404"></a><a class="code" href="a00026.html#e6f86706b8ae3495d3794b8c684fff0f">00404</a>     <span class="keywordtype">void</span> <a class="code" href="a00001.html#21aba63d066ae7897de6ca7d8425c408" title="Resets algorithm.">reset</a>()
<a name="l00405"></a>00405     {
<a name="l00406"></a>00406         st_ord.erase (st_ord.begin(), st_ord.end());
<a name="l00407"></a>00407     }
<a name="l00408"></a>00408 <span class="keyword">protected</span>:
<a name="l00412"></a>00412     <a class="code" href="a00010.html" title="An edge in a graph.">edge</a> st;
<a name="l00413"></a>00413 
<a name="l00417"></a>00417     <a class="code" href="a00020.html" title="A node in a graph.">node</a> s;
<a name="l00418"></a>00418 
<a name="l00422"></a>00422     pathfinder* pf;
<a name="l00423"></a>00423 
<a name="l00427"></a>00427     list&lt;node&gt; st_ord;
<a name="l00428"></a>00428 
<a name="l00432"></a>00432     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;int&gt;</a> st_num;
<a name="l00433"></a>00433 };
<a name="l00434"></a>00434 
<a name="l00435"></a>00435 __GTL_END_NAMESPACE
<a name="l00436"></a>00436 
<a name="l00437"></a>00437 <span class="preprocessor">#endif // GTL_ST_NUMBER_H</span>
<a name="l00438"></a>00438 <span class="preprocessor"></span>
<a name="l00439"></a>00439 <span class="comment">//--------------------------------------------------------------------------</span>
<a name="l00440"></a>00440 <span class="comment">//   end of file</span>
<a name="l00441"></a>00441 <span class="comment">//--------------------------------------------------------------------------</span>
</pre></div>    <p class="links">
      <a href="http://www.uni-passau.de/">University of Passau</a>
      &nbsp;-&nbsp;
      <a href="http://www.fmi.uni-passau.de/">FMI</a>
      &nbsp;-&nbsp;
      <a href="http://www.fmi.uni-passau.de/fmi/lehrstuehle/brandenburg/">Theoretical
	Computer Science</a>
    </p>
  <div class="copyright">
      Design &copy; 2002, 2003 <a href="mailto:raitner@fmi.uni-passau.de">Marcus Raitner</a>,  University of Passau 
  </div>
</body>
</html>
